package iodemo;

import java.io.FileNotFoundException;
import java.io.FileWriter;
import java.io.IOException;

public class FileRW
{
    public static void main (String[] args) throws FileNotFoundException
    {
//        try(FileReader fileReader = new FileReader("D:/iDonotKnow.txt"))
//        {
//            int temp = 0;
//
//            StringBuilder stringBuilder = new StringBuilder();
//
//            while((temp = fileReader.read()) != -1)
//            {
//                stringBuilder.append(temp);
//            }
//
//            System.out.println(stringBuilder);
//        }
        
        //不存在会新建文件的
        try(FileWriter fileWriter = new FileWriter("D:/iKnowIKnow.txt", true))
        {
            //新的方法
            fileWriter.write("fuck?");
            
            fileWriter.flush();
        }
        catch(IOException e)
        {
            e.printStackTrace();
        }
    }
}
